package com.install.core.util;

import java.io.Serializable;

import net.sf.json.JSONObject;

public class Response implements Serializable{
	int rtnCode=0;
    int rtnMsgCode=0;
    String rtnMsg;
    JSONObject rtnObject;
    
    public Response(){}
    public Response(int rtnCode,int rtnMsgCode,String rtnMsg)
    {
   	 this.rtnCode=rtnCode;
   	 this.rtnMsgCode=rtnMsgCode;
   	 this.rtnMsg=rtnMsg;
    }
    
    public Response(int rtnCode,int rtnMsgCode,String rtnMsg,JSONObject rtnObject)
    {
   	 setRtnCode(rtnCode);
   	 setRtnMsgCode(rtnMsgCode);
   	 setRtnMsg(rtnMsg);
   	 setRtnObject(rtnObject);
    }
    
    public String getRtnJSON()
    {
   	 JSONObject rtnObject=new JSONObject();
   	 
   	 JSONObject statusObject=new JSONObject();
   	 statusObject.element("rtnCode", this.getRtnCode());
   	 statusObject.element("rtnMsgCode",this.getRtnMsgCode());
   	 statusObject.element("rtnMsg",this.getRtnMsg());
   	 
   	 rtnObject.element("rtnStatus", statusObject);
   	 
   	 rtnObject.element("rtnData",this.getRtnObject());
   	 
   	 return rtnObject.toString();
    }
    
    public void setResponse(int rtnCode,int rtnMsgCode,String rtnMsg,JSONObject rtnObject)throws Exception
    {
   	 setRtnCode(rtnCode);
   	 setRtnMsgCode(rtnMsgCode);
   	 setRtnMsg(rtnMsg);
   	 setRtnObject(rtnObject);
    }
	/**
	 * @return the rtnCode
	 */
	public int getRtnCode()
	{
		return rtnCode;
	}
	/**
	 * @param rtnCode the rtnCode to set
	 */
	public void setRtnCode(int rtnCode)
	{
		this.rtnCode = rtnCode;
	}
	/**
	 * @return the rtnMsgCode
	 */
	public int getRtnMsgCode()
	{
		return rtnMsgCode;
	}
	/**
	 * @param rtnMsgCode the rtnMsgCode to set
	 */
	public void setRtnMsgCode(int rtnMsgCode)
	{
		this.rtnMsgCode = rtnMsgCode;
	}
	/**
	 * @return the rtnMsgMsg
	 */
	public String getRtnMsg()
	{
		return rtnMsg;
	}
	/**
	 * @param rtnMsgMsg the rtnMsgMsg to set
	 */
	public void setRtnMsg(String rtnMsg)
	{
		this.rtnMsg = rtnMsg;
	}
	/**
	 * @return the rtnObject
	 */
	public JSONObject getRtnObject()
	{
		return rtnObject;
	}
	/**
	 * @param rtnObject the rtnObject to set
	 */
	public void setRtnObject(JSONObject rtnObject)
	{
		this.rtnObject = rtnObject;
	}
    
}
